import request from '@/utils/request'

// 获取客户列表
export function getCustomerList(params) {
  return request({
    url: '/api/customers/list/',
    method: 'get',
    params
  })
}

// 测试API
export function testCustomerAPI() {
  return request({
    url: '/api/customers/test/',
    method: 'get'
  })
}

// 获取客户详情
export function getCustomerDetail(customerId) {
  return request({
    url: `/api/customers/detail/${customerId}/`,
    method: 'get'
  })
}

// 获取客户详情（调试版）
export function getCustomerDetailDebug(customerId) {
  return request({
    url: `/api/customers/debug/${customerId}/`,
    method: 'get'
  })
}

// 创建客户
export function createCustomer(data) {
  return request({
    url: '/api/customers/create/',
    method: 'post',
    data
  })
}

// 更新客户
export function updateCustomer(customerId, data) {
  return request({
    url: `/api/customers/update/${customerId}/`,
    method: 'put',
    data
  })
}

// 删除客户
export function deleteCustomer(customerId) {
  return request({
    url: `/api/customers/delete/${customerId}/`,
    method: 'delete'
  })
}

// 客户流失预测
export function predictCustomerChurn(customerId) {
  return request({
    url: `/api/predictions/predict/${customerId}/`,
    method: 'post'
  })
}

// 获取客户ID列表
export function getCustomerIds() {
  return request({
    url: '/api/customers/ids/',
    method: 'get'
  })
}

// 获取高风险客户列表
export function getHighRiskCustomers(params) {
  return request({
    url: '/api/customers/high-risk/',
    method: 'get',
    params
  })
}

// 生成随机客户数据
export function generateRandomCustomers() {
  return request({
    url: '/api/customers/generate-random/',
    method: 'post'
  })
}